﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Collections.Generic;
using System.IO.IsolatedStorage;
using System.IO;
using System.Diagnostics;
using System.Xml.Linq;

namespace WP7_calendar.Model
{
    public class Month
    {
        public List<CalendarItem> Calendar { get; set; }

        /// <summary>
        /// Create the nested list neccessary for showing the big calendar
        /// </summary>
        public Month()
        {
            DateTime date = DateTime.Today;
            while (date.DayOfWeek != DayOfWeek.Monday)
            {
                date = date.AddDays(-1);
            }
            Calendar = new List<CalendarItem>();
            for (int i = 0; i < 6; i++)
            {
                Calendar.Add(new CalendarItem());
                for (int j = 0; j < 7; j++)
                {
                    Calendar[i].Item.Add(new KeyValuePair<string, string>((date.Day).ToString(), date.ToString().Substring(0,10)));
                    date = date.AddDays(1);
                }
            }
        }
    }

    /// <summary>
    /// Data structure to aid in databinding
    /// </summary>
    public class CalendarItem
    {
        public List<KeyValuePair<string, string>> Item { get; set;}

        public CalendarItem()
        {
            Item = new List<KeyValuePair<string, string>>();
        }
    }

}